package lang.function;

import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author LiDong
 * @version 1.0.0
 * @createTime 6/22/2022 4:22 PM
 */
public class FunctionApiTest {

    private static final Logger logger = LoggerFactory.getLogger(FunctionApiTest.class);

    private int calculate(CalculateNum calculateNum, int a, int b) {
        return calculateNum.add(a, b);
    }

    @Test
    public void test() {
        int addResult = calculate((a, b) -> a - b, 1, 2);
        int subResult = calculate(Integer::sum, 1, 2);
        logger.info(String.valueOf(addResult));
        logger.info(String.valueOf(subResult));
    }

}
